﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>showhide</title>


    <!-- WinJSContrib.Core references -->
    <script src="./scripts/jquery-2.1.1.js"></script>
    <script src="./scripts/winjscontrib/jquery.mcnext.WinJS.js"></script>
    <script src="./scripts/winjscontrib/mcnext.ui.utils.js"></script>
    <script src="./scripts/winjscontrib/mcnext.ui.bindings.js"></script>
    <script src="./scripts/winjscontrib/mcnext.ui.twowaybindings.js"></script>

    <link href="showhide.css" rel="stylesheet" />
    <script src="showhide.js"></script>
</head>
<body>
    <div class="showhide fragment">
        <header aria-label="Header content" role="banner">
            <button class="win-backbutton" aria-label="Back" disabled type="button"></button>
            <h1 class="titlearea win-type-ellipsis">
                <span class="pagetitle">show, hide, or disable elements</span>
            </h1>
            <div class="codelink" data-codepage="./pages/bindings/showhide/showhide"><span class="symbol">&#xE160;</span><span class="text">show me the code !</span></div>
        </header>
        <section class="desc-screen" aria-label="Main content" role="main">
            <div class="bloc-description">
                <p>A common pattern in applications is to show or hide elements based on a boolean value, or the fact that a property exists or is filled</p>
                <p>
                    This sample demonstrate the use of custom bindings to achieve that.
                </p>
            </div>
            <div class="bloc-content">
                <div>
                    <input type="checkbox" id="cbxstate" data-win-bind="checked: isActive MCNEXT.Bindings.twoWayOnChange" /> <label for="cbxstate">I'm in</label>
                </div>
                <div class="split">
                    <div>
                        <p>
                            The following element is put to display 'none' if you're not in
                        </p>
                        <p>
                            &nbsp;<b data-win-bind="display : isActive MCNEXT.Bindings.showIf">I'm visible because I'm defined or true</b>
                        </p>
                        <p>
                            The following element is put to opacity=0 if you're not in
                        </p>
                        <p>
                            &nbsp;<b data-win-bind="opacity : isActive MCNEXT.Bindings.showIf">I'm visible because I'm defined or true</b>
                        </p>
                        <p>
                            The following button is disabled if you're not in
                        </p>
                        <p>
                            <button data-win-bind="disabled : isActive MCNEXT.Bindings.enableIf">My button</button>
                        </p>
                    </div>
                    <div>
                        <p>
                            The following element is put to display 'none' if  you're in
                        </p>
                        <p>
                            &nbsp;<b data-win-bind="display : isActive MCNEXT.Bindings.hideIf">I'm visible because I'm undefined or false</b>
                        </p>
                        <p>
                            The following element is put to opacity=0 if  you're in
                        </p>
                        <p>
                            &nbsp;<b data-win-bind="opacity : isActive MCNEXT.Bindings.hideIf">I'm visible because I'm undefined or false</b>
                        </p>
                        <p>
                            The following button is disabled if you're in
                        </p>
                        <p>
                            <button data-win-bind="disabled : isActive MCNEXT.Bindings.disableIf">My button</button>
                        </p>
                    </div>
                </div>
            </div>
        </section>
    </div>
</body>
</html>
